package DailyPractice.Day19;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 喝汽水
 * @author lumin
 * @date 2022/05/15 20:23
 **/
public class Num1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Integer> ret = new ArrayList<Integer>();
        while(sc.hasNextLine()){
            int KNum = sc.nextInt();
            if(KNum == 0){
                break;
            }
            ret.add(maxNum(KNum));
        }
        for (int i = 0; i < ret.size(); i++) {
            System.out.println(ret.get(i));
        }
    }

    private static int maxNum(int kNum) {
        int sum = 0;
        while(kNum >= 3){
            int HNum = 0;
            sum += kNum / 3;
            HNum = kNum / 3;
            kNum = kNum % 3;
            kNum += HNum;
        }
        if(kNum == 2){
            return sum += 1;
        }else{
            return sum;
        }
    }
}